<?
require_once("../config/dbconn.php");require_once("../config/powercls.php");require_once("../config/pagecls.php");

if($action=='ft_isend'){
	$sqlhy="select * from {$db_prefix}users where id='$id'";
	$rshy=$db->get_one($sqlhy);
	
	if($rshy["ft_isend"]==0)
	{
		$sqlgx="update {$db_prefix}users set ft_isend=1 where id='$id'";
	}
	else
	{
		$sqlgx="update {$db_prefix}users set ft_isend=0 where id='$id'";
	}
	$db->query($sqlgx);

	echo "<script>location.href='user_lst.php?pageno={$pageno}';</script>";exit();
}
if($action=='fhstata'){
  $sqlhy="select * from {$db_prefix}users where id='$id'";
  $rshy=$db->get_one($sqlhy);
  
  if($rshy["fhstata"]==0)
  {
    $sqlgx="update {$db_prefix}users set fhstata=1 where id='$id'";
  }
  else
  {
    $sqlgx="update {$db_prefix}users set fhstata=0 where id='$id'";
  }
  $db->query($sqlgx);

  echo "<script>location.href='user_lst.php?pageno={$pageno}';</script>";exit();
}

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	
}
td{
font-size:12px;
}
-->
</style>

<link href="images/skin.css" rel="stylesheet" type="text/css" />
<title>ImToken申请记录</title>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td width="935" height="29" valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">ImToken申请记录</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                <tr>
                  <td align="center" class="left_bt2">
<form name="form1" method="post" action="?action=query">
	  用户名：
	  <label>
      <input name="username" type="text" id="username" size="5">
      </label>
      处理状态：
    <label>
      <select name="status" >
        <option value="">全部</option>
        <option value="1">待处理</option>
        <option value="2">处理成功</option>
        <option value="3">处理失败/拒绝</option>
      </select>
      </label>
    <label></label>
  <label>
  <input type="submit" name="Submit" value="查询">
  </label>
                        </form></td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td height="30"><table width="100%" height="60" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
                <tr>
                  <td height="30" align="center" bgcolor="#f2f2f2" >编号</td>
                  <td align="center" bgcolor="#f2f2f2" >用户名</td>
                  <td align="center" bgcolor="#f2f2f2" >姓名</td>
                  <td align="center" bgcolor="#f2f2f2" >钱包地址</td>
                  <td align="center" bgcolor="#f2f2f2" >钱包类型</td>
                  <td align="center" bgcolor="#f2f2f2" >金额</td>
                  <td align="center" bgcolor="#f2f2f2" >处理状态</td>
                  <td align="center" bgcolor="#f2f2f2" >备注</td>
                  <td align="center" bgcolor="#f2f2f2" >申请时间</td>
                  <td align="center" bgcolor="#f2f2f2" >处理时间</td>
                  <td height="30" align="center" bgcolor="#f2f2f2" >操作</td>
                  </tr>
				  <tbody bgcolor="#FFFFFF">
	 <?
  $query='';

  
  if ($action=='query'){
    if (trim($username)!='') $query.=" and username ='".trim($username)."'";
    $status = (int)$status;
    if(!empty($status)){
        $query.=" and status = ".($status-1);
    }
  }
  
  $sql="select count(im.id) as c  from {$db_prefix}users as u inner join {$db_prefix}imtoken as im on u.id = im.userid where 1 ";
  if ($query!='') $sql.=$query;
  $rs=$db->get_one($sql);
  $page=new pagecls(20,intval($rs['c']));
  $sql="select im.id,u.username,u.nickname,im.imtoken,im.price,im.status,im.remark,im.addtime,im.finishtime,im.wallet_type from {$db_prefix}users as u inner join {$db_prefix}imtoken as im on u.id = im.userid where 1";
  if ($query!='') $sql.=$query;
  $sql.=" order by im.id desc limit {$page->pastnum},{$page->pagesize}";
  $result=$db->query($sql);
  while($rs=$db->fetch_array($result)){
  ?>
                <tr>
                  <td align="center"><?=$rs['id']?></td>
                  <td align="center"><?=$rs['username']?></td>
                  <td align="center">
                    <?=$rs['nickname']?>                  </td>
                  <td align="center"><?=$rs['imtoken']?></td>
                  <td align="center"><?php if($rs['wallet_type'] == 0) echo '未知'; elseif($rs['wallet_type'] == 1) echo '交易钱包'; elseif($rs['wallet_type'] == 2) echo '购物钱包';else echo '其他钱包';?></td>
                  <td align="center" ><?=$rs['price']?></td>
                  <td align="center" ><?php if($rs['status'] == 0) echo '未处理'; elseif($rs['status'] == 1) echo '已处理完成'; elseif($rs['status'] == 2) echo '已拒绝处理';?></td>
                  <td align="center" ><?=$rs['remark']?></td>
                  <td align="center" ><?php if($rs['addtime']) echo date("Y-m-d H:i:s",$rs['addtime']);else echo '--:--'; ?></td>
                  <td align="center" ><?php if($rs['finishtime']) echo date("Y-m-d H:i:s",$rs['finishtime']);else echo '--:--'; ?></td>
                  </td>
                  <td height="30" align="center" >
                  <a href="imtoken_view.php?id=<?=$rs['id']?>&pageno=<?=$page->pageno?>">查看</a> 
                  </tr>
 <?
  }
  $db->free_result($result);
  ?>
  </tbody>
              </table></td>
            </tr>
            
            <tr>
              <td height="30">&nbsp;</td>
            </tr>
            <tr>
              <td height="30" align="right"><form action="?<?=$page->url?>" method="post" style="margin:0px ; padding:0px;">每页<?=$page->pagesize?>条 第<?=$page->pageno?>/<?=$page->pagenum?>页 共<?=$page->recnum?>条 <a href='?<?=$page->url?>1'><img src="image1/first.gif" border="0"></a>   <a href='?<?=$page->url.($page->pageno-1)?>'><img src="image1/back.gif" border="0"></a>  <a href='?<?=$page->url.($page->pageno+1)?>'><img src="image1/next.gif" border="0"></a>   <a href='?<?=$page->url.$page->pagenum?>'><img src="image1/last.gif" border="0"></a> 
			转到：<input name="pageno" value="" size="1" type="text"> <input name="gobg" value="go" type="submit">
			  </form></td>
              </tr>
          </table></td>
      </tr>
    </table></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
      <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
<!-- <p>示例弹出层：<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">请点这里</a></p>  -->
        <div id="light" class="white_content">这是一个层窗口示例程序. 
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">点这里关闭本窗口</a></div> 
        <div id="fade" class="black_overlay"></div> 
</body>
<style> 
        .black_overlay{ 
            display: none; 
            position: absolute; 
            top: 0%; 
            left: 0%; 
            width: 100%; 
            height: 100%; 
            background-color: black; 
            z-index:1001; 
            -moz-opacity: 0.8; 
            opacity:.80; 
            filter: alpha(opacity=88); 
        } 
        .white_content { 
            display: none; 
            position: absolute; 
            top: 25%; 
            left: 25%; 
            width: 55%; 
            height: 55%; 
            padding: 20px; 
            border: 10px solid orange; 
            background-color: white; 
            z-index:1002; 
            overflow: auto; 
        } 
    </style>
<script type="text/javascript">
  function a(){
    alert(html'<p>123456</p>');
  }
</script>
</html>
